package com.kit.personalkit.common;

import lombok.Data;

@Data
public class JsonResponseBody {
    //状态码
    private Integer code;

    // 消息提示
    private String message;

    // 具体数据
    private Object data;

    public JsonResponseBody(Object data) {
        this.data = data;
    }

    public JsonResponseBody(int code,String message){
        this.code=code;
        this.message=message;
    }

    public JsonResponseBody(ResponseStatus statusCode) {
        this.code = statusCode.getCode();
        this.message = statusCode.getMsg();
    }

    public JsonResponseBody(ResponseStatus statusCode, Object data) {
        this(statusCode);
        this.data = data;
    }
    public static JsonResponseBody ok(Object data){
        JsonResponseBody resultVO = new JsonResponseBody(ResponseStatus.SUCCESS,data);
        return resultVO;
    }

    public static JsonResponseBody ok(){
        return ok(null);
    }

}
